package com.baoxin.chenxixc4coach.java;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonSyntaxException;

/**
 * 返回结果只关注code，用这个接受
 */
public class SimpleResultHelper {


    class Result {

        String code;

        public String getCode() {
            return code;
        }

    }

    public static boolean isSucceed(String result) {
        Gson gson = new GsonBuilder().serializeNulls().create();
        try {
            Result r = gson.fromJson(result, Result.class);
            if (r.getCode().equals("0")) {
                return true;
            } else {
                return false;
            }
        } catch (JsonSyntaxException exception) {
            return false;
        }


    }

}
